﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using EHTSaleManager.Code.BLL;
using EHTSaleManager.Code.Entity;
using EHTSaleManager.Code.Utility;
using System.Web.Security;

namespace EHTSaleManager.UIAdmin
{
    public partial class AdminCustomerComfirmDelete : System.Web.UI.Page
    {
        public String UserName = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["UserName"] != null)
            {
                try
                {
                    UserName = Request.QueryString["UserName"].ToString();
                }
                catch (Exception ex)
                {
                    UserName = "";
                }
            }

            if (UserName != "")
            {
                MembershipUser theUser = Membership.GetUser(UserName);
                ViewState["UserName"] = theUser.UserName;
                this.ltrMessage.Text = "Er du sikker sletter kunde : " + theUser.UserName;
            }
        }

        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (ViewState["UserName"] != null)
            {
                UserName = ViewState["UserName"].ToString();
                Membership.DeleteUser(UserName.ToString());
            }

            Response.Redirect("AdminCustomers.aspx");
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("AdminCustomers.aspx");
        }
    }
}